{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "initial_id",
   "metadata": {
    "collapsed": true,
    "is_executing": true
   },
   "outputs": [],
   "source": [
    "# 包导入 ----->>>>>>>>  开始\n",
    "from pythonProjectTemplate.Controller.pandas_data_controller import 数据操作\n",
    "from pythonProjectTemplate.Controller.pandas_query_controller import pandas数据筛查\n",
    "from pythonProjectTemplate.Controller.file_controller import 加载文件\n",
    "\n",
    "from pythonProjectTemplate.Entity.Enum.calculating_type_enum import 多列运算\n",
    "from pythonProjectTemplate.Entity.SystemEntity.data_duplicate_checking_entity import data_duplicate_checking_entity\n",
    "from pythonProjectTemplate.Entity.SystemEntity.get_sheet_data_value_entity import 获取指定列配置文件\n",
    "from pythonProjectTemplate.Entity.SystemEntity.load_excel_properties import 读取Excel表单的配置\n",
    "from pythonProjectTemplate.Entity.SystemEntity.calculating_multiple_columns_entity import 多列运算配置文件\n",
    "\n",
    "from pythonProjectTemplate.Utils.print_logo_util import print_logo\n",
    "\n",
    "# 包导入 ----->>>>>>>>  结束\n",
    "\n",
    "# logo打印 ------>>>>>>>>>>  开始   不想要,可注释掉\n",
    "print_logo()\n",
    "# logo打印 ------>>>>>>>>>>  结束"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "outputs": [],
   "source": [
    " # 文件读取----->>>>>>>>  开始\n",
    "pro_list = []\n",
    "set_excel_properties_1 = (读取Excel表单的配置()\n",
    "                          .配置表单名(\"BOM清单\")\n",
    "                          .跳过指定的行(1)\n",
    "                          .配置读取前几行(None)\n",
    "                          .配置读取的列(None))\n",
    "\n",
    "set_excel_properties_2 = (读取Excel表单的配置()\n",
    "                          .配置表单名(\"价格清单\")\n",
    "                          .跳过指定的行(None)\n",
    "                          .配置读取前几行(None)\n",
    "                          .配置读取的列(None))\n",
    "\n",
    "set_excel_properties_3 = (读取Excel表单的配置()\n",
    "                          .配置表单名(\"单车成本计算\")\n",
    "                          )\n",
    "\n",
    "\n",
    "pro_list.append(set_excel_properties_1)\n",
    "pro_list.append(set_excel_properties_2)\n",
    "pro_list.append(set_excel_properties_3)\n",
    "\n",
    "\n",
    "源数据 = 加载文件(\"res/技能大赛Python数据集.xlsx\", pro_list)\n",
    "print(源数据)\n",
    "# 文件读取----->>>>>>>>  结束"
   ],
   "metadata": {
    "collapsed": false,
    "is_executing": true
   },
   "id": "f388f2a73227861c"
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "outputs": [],
   "source": [
    "# 获取指定列表内指定索引的值配置 ---->>>>>>>>>>>>>>  开始\n",
    "数据截取配置文件 = (获取指定列配置文件()\n",
    "                    .配置文件名(\"技能大赛Python数据集\")\n",
    "                    .配置表单名(\"BOM清单\")\n",
    "                    .配置列索引([1,2,3]))\n",
    "数据截取后文件 = pandas数据筛查.数据截取(源数据, 数据截取配置文件)\n",
    "print(数据截取后文件)\n",
    "# 获取指定列表内指定索引的值配置 ---->>>>>>>>>>>>>>  结束"
   ],
   "metadata": {
    "collapsed": false,
    "is_executing": true
   },
   "id": "f44868b6f7a5c358"
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "outputs": [],
   "source": [
    " # 数据查重 ---->>>>>>>>>>>>>>  开始\n",
    "数据查重配置文件 = (data_duplicate_checking_entity()\n",
    "                    .配置文件名(\"技能大赛Python数据集\")\n",
    "                    .配置表单名(\"价格清单\")\n",
    "                    .配置列索引([\"零件名称\"]))\n",
    "数据查重结果 = pandas数据筛查.数据查重(源数据,[数据查重配置文件])\n",
    "print(数据查重结果)\n",
    "    # 数据查重 ---->>>>>>>>>>>>>>  结束"
   ],
   "metadata": {
    "collapsed": false,
    "is_executing": true
   },
   "id": "8198ae0d2b8f1203"
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "outputs": [],
   "source": [
    "# 删除指定重复数据------------->>>>>>>>>>>>>>>>>>>>>  开始\n",
    "\n",
    "已筛除重复数据 = 数据操作.按照条件删除指定数据(源数据.get(\"技能大赛Python数据集\").get(\"价格清单\"), \"df['序号'] == 'test'\")\n",
    "print(已筛除重复数据)\n",
    "\n",
    "    # 删除指定重复数据------------->>>>>>>>>>>>>>>>>>>>>  结束"
   ],
   "metadata": {
    "collapsed": false
   },
   "id": "83b3547082e8278c"
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "outputs": [],
   "source": [
    " # 表合并 --->>>>>>>>>>>>>>>>>  开始\n",
    "\n",
    "表合并后数据 = pandas数据筛查.合并表([源数据.get(\"技能大赛Python数据集\").get(\"BOM清单\"),\n",
    "                                        源数据.get(\"技能大赛Python数据集\").get(\"价格清单\")],\n",
    "                                   [\"零件编号\"],\n",
    "                                   \"inner\")\n",
    "\n",
    "print(表合并后数据)\n",
    "\n",
    "    # 表合并 --->>>>>>>>>>>>>>>>>  结束"
   ],
   "metadata": {
    "collapsed": false
   },
   "id": "c629fbcf671093ce"
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "outputs": [],
   "source": [
    " # 筛查指定列是否包含某些值 --->>>>>>>>> 开始\n",
    "result = pandas数据筛查.指定列值筛查(df=源数据.get(\"技能大赛Python数据集\").get(\"BOM清单\"), col_value=\"零件名称\",\n",
    "                                value_list=[\"零件\"])\n",
    "\n",
    "print(result)\n",
    "    # 筛查指定列是否包含某些值 --->>>>>>>>> 结束"
   ],
   "metadata": {
    "collapsed": false
   },
   "id": "b97e414250c6439e"
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "outputs": [],
   "source": [
    "# 多列运算  --->>>>>>>  开始\n",
    "\n",
    "多列运算配置 = (多列运算配置文件()\n",
    "                        .配置数据集(表合并后数据)\n",
    "                      .配置文件名(\"技能大赛Python数据集\")\n",
    "                      .配置表名(\"BOM清单\")\n",
    "                      #   [{\"key\":\"value\"},....]  SZHBG-2023_multiply_零件价格1\n",
    "                      .配置第一个参数([\"SZHBG-2023\",\n",
    "                                       \"SZHBG-2024\",\n",
    "                                       \"SZHBG-2025\",\n",
    "                                       \"SZHBG-2026\",\n",
    "                                       \"SZHBG-2027\",\n",
    "                                       \"SZHBG-2028\",\n",
    "                                       \"SZHBG-2029\",\n",
    "                                       \"SZHBG-2030\",\n",
    "                                       \"SZHBG-2031\",\n",
    "                                       \"SZHBG-2032\",\n",
    "                                       \"SZHBG-2033\",\n",
    "                                       \"SZHBG-2034\",\n",
    "                                       \"SZHBG-2035\",\n",
    "                                       \"SZHBG-2036\",\n",
    "                                       \"SZHBG-2037\",\n",
    "                                       \"SZHBG-2038\",\n",
    "                                       \"SZHBG-2039\",\n",
    "                                       \"SZHBG-2040\",\n",
    "                                       ])\n",
    "                      .配置第二个参数([\"零件价格\"])\n",
    "                      .配置运算符(多列运算.乘))\n",
    "\n",
    "result = 数据操作.多列运算(多列运算配置)\n",
    "print(result.columns.values)\n",
    "\n",
    "    # 多列运算  --->>>>>>>  结束"
   ],
   "metadata": {
    "collapsed": false
   },
   "id": "1c7645bf6fa07c72"
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "outputs": [],
   "source": [
    "sheet_properties = 获取指定列配置文件().配置列索引([27, 28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44])\n",
    "print(sheet_properties.get_col_index())\n",
    "result = pandas数据筛查.数据截取(result, sheet_properties)\n",
    "print(result)"
   ],
   "metadata": {
    "collapsed": false
   },
   "id": "b2edab1d9038e092"
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "outputs": [],
   "source": [
    "result = 数据操作.指定行或列求和(result, 0, 18, \"\",flag=False)\n",
    "数据截取配置文件 = (获取指定列配置文件()\n",
    "                    .配置行索引([20000]))\n",
    "数据截取后文件 = pandas数据筛查.数据截取(result, 数据截取配置文件)\n",
    "print(数据截取后文件)"
   ],
   "metadata": {
    "collapsed": false
   },
   "id": "f88a0a4bdde5b043"
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
